package pageObject;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;

public class LoginPage {
	/**
	 * 封装登录页
	 */
	WebDriver driver;
	
	@FindBy(how=How.ID,id="account")
	private WebElement userName;
	@FindBy(how=How.ID,id="password")
	private WebElement passWord;
	@FindBy(how=How.ID,id="login")
	private WebElement loginButton;
	
	
	public LoginPage(WebDriver driver){
		this.driver=driver;		
	}
	
	/**
	 * 登录
	 */
	public void login(String Name,String passWd){
		
//		driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
		
		if(userName.getText().length()>0){
			userName.clear();
		}
		userName.sendKeys(Name);
		
		if(passWord.getText().length()>0){
			passWord.clear();
		}
		passWord.sendKeys(passWd);
		
		loginButton.click();
		

	}



}
